package com.sino.dataworks.enums;

public enum ProjectEnums {
    SHU_CANG(10022L,"数仓","odps.datawarehouse_pro",new String[]{"datawarehouse_pro","datawarehouse_dev"}),
    GPS(10023L,"GPS","odps.gps_project",new String[]{"gps_project","gps_project_dev"}),
    SUAN_FA(10024L,"算法","odps.algo_pro",new String[]{"algo_pro","algo_dev"});
    private Long code;
    private String desc;
    private String engine;
    private String[] env;
    ProjectEnums(Long code,String desc){
        this.code=code;
        this.desc=desc;
    }
    ProjectEnums(Long code,String desc,String engine){
        this.code=code;
        this.desc=desc;
        this.engine=engine;
    }
    ProjectEnums(Long code,String desc,String engine,String[] env){
        this.code=code;
        this.desc=desc;
        this.engine=engine;
        this.env=env;
    }

    public String[] getEnv() {
        return env;
    }

    public void setEnv(String[] env) {
        this.env = env;
    }

    public Long getCode() {
        return code;
    }

    public void setCode(Long code) {
        this.code = code;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    public String getEngine() {
        return engine;
    }

    public void setEngine(String engine) {
        this.engine = engine;
    }

    public static String getDesc(Long code) {
        for (ProjectEnums status : ProjectEnums.values()) {
            if (status.getCode() == code) {
                return status.getDesc();
            }
        }
        return null;
    }
    public static String getEngineByCode(Long code) {
        for (ProjectEnums status : ProjectEnums.values()) {
            if (status.getCode() == code) {
                return status.getEngine();
            }
        }
        return null;
    }
    public static String[] getEnvByCode(Long code) {
        for (ProjectEnums status : ProjectEnums.values()) {
            if (status.getCode() == code) {
                return status.getEnv();
            }
        }
        return new String[]{};
    }
    public static Long getCode(String desc) {
        for (ProjectEnums status : ProjectEnums.values()) {
            if (status.getDesc().equals(desc)) {
                return status.getCode();
            }
        }
        return null;
    }
}
